package cn.ddiancan.xddcloud.psc.mq.factory;

import java.util.concurrent.ConcurrentHashMap;

import org.apache.rocketmq.client.producer.DefaultMQProducer;

public class XddcloudProducerFactory {

    public static ConcurrentHashMap<String, DefaultMQProducer> producerMap = new ConcurrentHashMap<>();

    public static DefaultMQProducer getProducer(String topic) {
        return producerMap.get(topic);
    }

    public static void putProducer(String topic, DefaultMQProducer producer) {
        if (!producerMap.containsKey(topic)) {
            producerMap.put(topic, producer);
        }
    }

}
